<template>
  <div>
    <el-dropdown @command="handleCommand">
      <span class="el-dropdown-link">
        langue:{{ $i18n.locale==="en"?"En":"中文" }}<i class="el-icon-arrow-down el-icon--right" />
      </span>
      <el-dropdown-menu slot="dropdown">
        <el-dropdown-item command="zn">中文</el-dropdown-item>
        <el-dropdown-item command="en">En</el-dropdown-item>
      </el-dropdown-menu>
    </el-dropdown>
  </div>
</template>

<script>
export default {

  methods: {
    handleCommand(newdata) {
      // this.$i18n.locale = newdata
      localStorage.setItem('lang', newdata)
      this.$i18n.locale = localStorage.getItem('lang')
    }
  }
}
</script>

<style scoped lang="scss">
::v-deep .el-dropdown-link{
    font-size: 16px;
    color: #ffffff;
}
</style>
